<?php 
namespace app\Home\controller;
use think\Controller;
use app\Home\model\Goodsmodel;
use think\Db;
use think\Request;
class Goods extends Controller
{
	public function goods_search(){
		$where   = [];
        $request = input('request.');
        $goods_nameComplex = [];
        if (!empty($request['goods_name'])) {
            $goods_name = $request['goods_name'];
            $goods_nameComplex['goods_name'] = ['like', "%$goods_name%"];
        }
        $usersQuery = Db::name('gs');
        $list = $usersQuery->whereOr($goods_nameComplex)
                           ->where($where)
                           ->order("goods_name DESC")
                           ->paginate(1,false,['query'=>Request::instance()->param()]);
        // 获取分页显示
        $page = $list->render();
        $this->assign('list', $list);
        $this->assign('page', $page);

		return $this->fetch();
	}

	public function goods_details(){
        $goods_id=input("get.goods_id");
        $model=new Goodsmodel();
        $goods_xq=$model->select($goods_id);
        $this->assign("goods_xq",$goods_xq);
		return $this->fetch();
	}
	
}